
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Spring异常 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Spring异常 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">异常处理</div>
          <div class="card-question">当发生 "Bean注入失败" 异常时，其根本原因是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">异常处理</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">导致 "Bean注入失败" 的根本原因是IOC容器中没有找到与注入请求相匹配的bean。</div>
          </div>
          <div class="card-source">来源: Bean注入失败</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">排错</div>
          <div class="card-question">为解决 "Bean注入失败" 问题，可以从哪三个方面进行检查以确保bean被IOC容器管理？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">排错</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以检查以下三点：1. 是否开启了包扫描；2. 相关的类上面是否添加了如 @Controller 之类的注解；3. 如果是Mapper接口，是否为其创建了代理。</div>
          </div>
          <div class="card-source">来源: Bean注入失败</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">当Spring报告 "找到了多个匹配的bean" 时，通常是什么原因导致的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">这个异常的原因是，当按照类型进行依赖注入时，IOC容器中存在两个或以上可以匹配该类型的bean实例。</div>
          </div>
          <div class="card-source">来源: 找到了多个匹配的bean</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">排错</div>
          <div class="card-question">如果因为IOC容器中存在多个同类型的bean而导致注入失败，文档中提到了哪两种解决方法？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">排错</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到了两种解决方法：1. 按照名字（bean的ID）进行注入；2. 为bean区分主次（例如使用@Primary注解）。</div>
          </div>
          <div class="card-source">来源: 找到了多个匹配的bean</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">异常处理</div>
          <div class="card-question">导致 "类找不到异常" (ClassNotFoundException) 的常见原因有哪些？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">异常处理</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">常见原因有三个：1. 指定的类在classpath路径下确实不存在；2. 没有导入该类所在的依赖包；3. 项目中存在两个或多个不同版本的依赖包，导致了冲突。</div>
          </div>
          <div class="card-source">来源: 类找不到异常</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">排错</div>
          <div class="card-question">如何解决由依赖问题（缺失或冲突）引起的 "类找不到异常"？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">排错</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">1. 如果是缺少依赖，就找到并导入对应的依赖包。 2. 如果是由于多个版本依赖冲突导致的，需要排除掉版本较低的依赖，只保留一个版本。</div>
          </div>
          <div class="card-source">来源: 类找不到异常</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
